home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / dev / gcc / geninline_920614.lha / inline-2.0 / cia.h < prev    next >
C/C++ Source or Header  |  1992-06-14  |  2KB  |  86 lines

  1. #ifndef _INLINE_CIA_H
  2. #define _INLINE_CIA_H
  3.  
  4. #include <sys/cdefs.h>
  5. #include <inline/stubs.h>
  6.  
  7. __BEGIN_DECLS
  8.  
  9. #ifndef BASE_EXT_DECL
  10. #define BASE_EXT_DECL extern struct cia_protosBase*  cia_protosBase;
  11. #endif
  12. #ifndef BASE_PAR_DECL
  13. #define BASE_PAR_DECL
  14. #define BASE_PAR_DECL0 void
  15. #endif
  16. #ifndef BASE_NAME
  17. #define BASE_NAME cia_protosBase
  18. #endif
  19.  
  20. static __inline WORD 
  21. AbleICR (BASE_PAR_DECL struct Library *resource,long mask)
  22. {
  23.   BASE_EXT_DECL
  24.   register WORD  _res  __asm("d0");
  25.   register struct cia_protosBase* a6 __asm("a6") = BASE_NAME;
  26.   register struct Library *a6 __asm("a6") = resource;
  27.   register long d0 __asm("d0") = mask;
  28.   __asm __volatile ("jsr a6@(-0x12)"
  29.   : "=r" (_res)
  30.   : "r" (a6), "r" (a6), "r" (d0)
  31.   : "a0","a1","a6","d0","d1");
  32.   return _res;
  33. }
  34. static __inline struct Interrupt *
  35. AddICRVector (BASE_PAR_DECL struct Library *resource,long iCRBit,struct Interrupt *interrupt)
  36. {
  37.   BASE_EXT_DECL
  38.   register struct Interrupt * _res  __asm("d0");
  39.   register struct cia_protosBase* a6 __asm("a6") = BASE_NAME;
  40.   register struct Library *a6 __asm("a6") = resource;
  41.   register long d0 __asm("d0") = iCRBit;
  42.   register struct Interrupt *a1 __asm("a1") = interrupt;
  43.   __asm __volatile ("jsr a6@(-0x6)"
  44.   : "=r" (_res)
  45.   : "r" (a6), "r" (a6), "r" (d0), "r" (a1)
  46.   : "a0","a1","a6","d0","d1");
  47.   *(char *)a1 = *(char *)a1;
  48.   return _res;
  49. }
  50. static __inline void 
  51. RemICRVector (BASE_PAR_DECL struct Library *resource,long iCRBit,struct Interrupt *interrupt)
  52. {
  53.   BASE_EXT_DECL
  54.   register struct cia_protosBase* a6 __asm("a6") = BASE_NAME;
  55.   register struct Library *a6 __asm("a6") = resource;
  56.   register long d0 __asm("d0") = iCRBit;
  57.   register struct Interrupt *a1 __asm("a1") = interrupt;
  58.   __asm __volatile ("jsr a6@(-0xc)"
  59.   : /* no output */
  60.   : "r" (a6), "r" (a6), "r" (d0), "r" (a1)
  61.   : "a0","a1","a6","d0","d1");
  62.   *(char *)a1 = *(char *)a1;
  63. }
  64. static __inline WORD 
  65. SetICR (BASE_PAR_DECL struct Library *resource,long mask)
  66. {
  67.   BASE_EXT_DECL
  68.   register WORD  _res  __asm("d0");
  69.   register struct cia_protosBase* a6 __asm("a6") = BASE_NAME;
  70.   register struct Library *a6 __asm("a6") = resource;
  71.   register long d0 __asm("d0") = mask;
  72.   __asm __volatile ("jsr a6@(-0x1e)"
  73.   : "=r" (_res)
  74.   : "r" (a6), "r" (a6), "r" (d0)
  75.   : "a0","a1","a6","d0","d1");
  76.   return _res;
  77. }
  78. #undef BASE_EXT_DECL
  79. #undef BASE_PAR_DECL
  80. #undef BASE_PAR_DECL0
  81. #undef BASE_NAME
  82.  
  83. __END_DECLS
  84.  
  85. #endif /* _INLINE_CIA_H */
  86.